package dyyx.util;

import org.springframework.context.ApplicationContext;

public abstract class SpringUtil {
	
	private static volatile ApplicationContext  context = null;
	
	// private static volatile AllInOneService allInOneService;

			
   
	
	public synchronized static void setApplicationContext(ApplicationContext ctx){
		if(ctx==null){
			throw new RuntimeException("ctx is null");
		}
		if(context!=null){
			return;
		}
		
		context = ctx;
		
		// init();
		
	}
	
	
	public static ApplicationContext getApplicationContext(){
		if(context==null){
			throw new RuntimeException("context is null");
		}
		
		return  context;
	}
	
	/*
	
	public static AllInOneService getAllInOneService(){
		return allInOneService;
	}
	
	private static void init(){
		AllInOneService allInOneServiceTmp = (AllInOneService)context.getBean("allInOneServiceClient");
		allInOneService = allInOneServiceTmp;
	}
	
	*/
	

	


}
